//package com.markerhub.config;
//
//import org.apache.shiro.session.mgt.SessionManager;
//import org.crazycake.shiro.RedisSessionDAO;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.web.server.session.DefaultWebSessionManager;
//
///**
// * shiro启用注解拦截控制器
// */
//@Configuration
//public class ShiroConfig {
//
//    @Bean
//    public SessionManager sessionManager(RedisSessionDAO redisSessionDAO) {
//        DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
//        sessionManager.setSessionDAO(redisSessionDAO);
//        return sessionManager;
//    }
//
//    @Bean
//    public DefaultWebSecurityManager securityManager(AccountRealm accountRealm,
//                                                     SessionManager sessionManager,
//                                                     RedisCacheManager redisCacheManager) {
//        DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(accountRealm);
//        securityManager.setSessionManager(sessionManager);
//        securityManager.setCacheManager(redisCacheManager);
//        /*
//         * 关闭shiro自带的session，详情见文档
//         */
//        DefaultSubjectDAO subjectDAO = new DefaultSubjectDAO();
//        DefaultSessionStorageEvaluator defaultSessionStorageEvaluator = new DefaultSessionStorageEvaluator();
//        defaultSessionStorageEvaluator.setSessionStorageEnabled(false);
//        subjectDAO.setSessionStorageEvaluator(defaultSessionStorageEvaluator);
//        securityManager.setSubjectDAO(subjectDAO);
//        return securityManager;
//    }
//}
